//
//  QYXDailyModel.m
//  OpenYourEyes
//
//  Created by dllo on 16/6/6.
//  Copyright © 2016年 Google AdWords. All rights reserved.
//

#import "QYXDailyModel.h"
#import "QYXDailyItemListModel.h"
@implementation QYXDailyModel
- (instancetype)initWithDic:(NSDictionary *)dictionary
{
    self = [super initWithDic:dictionary];
    if (self) {
        NSMutableArray *headerArray = [NSMutableArray array];
        NSMutableArray *array = [NSMutableArray array];
        NSDictionary *dict = [NSDictionary dictionary];
        NSDictionary *dicc = [NSDictionary dictionary];
        for (NSDictionary *dic in _itemList) {
            if ([[dic objectForKey:@"type"] isEqualToString:@"video"]) {
                dict = [dic objectForKey:@"data"];
                QYXDailyItemListModel *model = [[QYXDailyItemListModel alloc] initWithDic:dict];
                [array addObject:model];
            }
            if ([[dic objectForKey:@"type"] isEqualToString:@"textHeader"] || [[dic objectForKey:@"type"] isEqualToString:@"imageHeader"]) {
                dicc = [dic objectForKey:@"data"];
                [headerArray addObject:dicc];
            }
        }
        
        self.headerArray = [NSArray arrayWithObject:headerArray];
        self.itemList = [NSArray arrayWithArray:array];
    }
    return self;
}

@end



